package org.kfive.nova.service.impl;

import org.kfive.nova.dao.ADao.StudentDao;
import org.kfive.nova.dao.BDao.ConfigDao;
import org.kfive.nova.model.Config;
import org.kfive.nova.model.Student;
import org.kfive.nova.service.JTAService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import java.util.Date;

/**
 * Created by admin on 2017-05-01.
 */
@Service
public class JTAServiceImpl implements JTAService{
    @Autowired
    private ConfigDao configDao;
    @Autowired
    private StudentDao studentDao;
    @Override
    public void save() {
        Config config = new Config();
        config.setUrl("1111111");
        config.setCreateTime(new Date());
        config.setUpdateTime(config.getCreateTime());
        config.setOperator("2222");
        this.configDao.save(config);
        Assert.hasLength("");
        Student student = new Student();
        student.setName("test");
        student.setSex(1);
        student.setDepartment("测试部");
        student.setAddress("中国");
        student.setBirth(2017);
        this.studentDao.save(student);
    }
}
